/* 种植小知识页面样式 */

/* 搜索栏样式 */
.search-section {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-md) 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 16px;
    background: var(--card-background);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.search-icon {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

/* 分类标签样式 */
.category-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: var(--spacing-xs);
    -webkit-overflow-scrolling: touch;
}

.category-tab {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--hover-background);
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab:hover {
    background: rgba(46, 204, 113, 0.15);
    color: var(--text-primary);
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-light);
}

/* 知识卡片样式 */
.tips-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.tip-card {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tip-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: var(--card-background-hover);
}

.tip-card:hover::before {
    opacity: 1;
}

.tip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.tip-category-badge {
    padding: 4px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tip-category-badge.基础 {
    background: rgba(46, 204, 113, 0.1);
    color: var(--primary-color);
}

.tip-category-badge.浇水 {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.tip-category-badge.施肥 {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

.tip-category-badge.病虫害 {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.tip-category-badge.收获 {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.tip-meta {
    display: flex;
    gap: var(--spacing-sm);
    font-size: 12px;
    color: var(--text-muted);
}

.tip-difficulty {
    background: var(--hover-background);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
}

.tip-read-time {
    background: var(--hover-background);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
}

.tip-card-body {
    flex: 1;
}

.tip-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm) 0;
    line-height: 1.4;
}

.tip-content-preview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--spacing-md) 0;
}

.tip-tags {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.tip-tag {
    background: rgba(46, 204, 113, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 500;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: var(--spacing-md);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-hover);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-content {
    padding: var(--spacing-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--hover-background);
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: var(--spacing-lg);
}

.tip-category {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tip-content {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-lg);
    white-space: pre-line;
}

.modal-footer {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-lg);
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-desc {
    font-size: 14px;
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .modal-container {
        margin: var(--spacing-sm);
        max-height: 95vh;
    }
    
    .modal-content {
        padding: var(--spacing-md);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .tip-card {
        padding: var(--spacing-md);
    }
    
    .tip-title {
        font-size: 16px;
    }
    
    .tip-content-preview {
        font-size: 13px;
    }
}

@media (max-width: 375px) {
    .search-section {
        padding: var(--spacing-md);
    }
    
    .category-tabs {
        margin-bottom: var(--spacing-md);
    }
    
    .tip-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .tip-meta {
        align-self: flex-end;
    }
}
